<?php
/* @var $this EventController */
/* @var $model Event */

$this->breadcrumbs=array(
	'Events'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Event', 'url'=>array('index')),
	array('label'=>'Create Event', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#event-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Events</h1>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'event-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		// 'id',
		array(
		'name'=>'id',
		'value'=>'"<div>".CHtml::link(\'抽奖\',\'index.php?r=win/index&eventid=\'.$data->id)."</div>"',
		'type'=>'raw'
		), 
		'title',

		// array(
		// 'name'=>'sendofmax',
		// 'value'=>'"<div title=\'"."最大发送量：".$data->sendofmax."<br>已发送量：".$data->sendtoday."<br>已派发量：".$data->toindex."\' rel=\'tooltip\'>".($data->sendtoday > $data->sendofmax?"<div class=disconnection title=\'$data->lasttime\'></div>已完成  ".CHtml::link(\'查看报表\',\'index.php?r=tasklog/admin&Tasklog[taskid]=\'.$data->id):"<div class=connection title=\'$data->lasttime\'></div>执行中... ".($data->sendofmax*$data->sendtoday/100)."%")',
		// 'type'=>'raw'
		// ), 

		// 'description',
		'award',
		'companyid',
		'hit',
		/*
		// 'adds',
		'starttime',
		'endtime',
		*/
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
